package com.eliaukjq.consumer;

import com.eliaukjq.common.model.User;
import com.eliaukjq.common.service.UserService;
import com.eliaukjq.jqrpc.proxy.ServiceProxyFactory;


/**
 * @Author : 佩萁
 * Description :服务消费者
 * @Create : 2024/2/23 - 11:03
 */
public class EasyConsumerExample {
    public static void main(String[] args) {
        //获取UserService的实现类对象
//        UserService userService = new UserServiceProxy();
        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("eliaukjq");
        //调用服务提供者的方法
        User newUser = userService.getUser(user);
        if (newUser!= null){
            System.out.println(newUser.getName());
        }
        else {
            System.out.println("没有找到对应的用户");
        }
    }
}
